/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.logiclander.adhocracy.jira.cli;

import com.atlassian.jira.rest.client.NullProgressMonitor;
import com.atlassian.jira.rest.client.domain.Project;
import com.logiclander.adhocracy.cli.CommandLineReactor;
import static com.logiclander.adhocracy.jira.cli.JiraCommandLineParserFactory.ARG_PROJECTKEY;
import org.apache.commons.cli2.CommandLine;
import org.springframework.context.ApplicationContext;

/**
 *
 * @author tim
 */
public class JiraShowProjectReactorFactory extends JiraCommandLineReactorFactory {

    public JiraShowProjectReactorFactory(ApplicationContext context) {
        super(context);
    }

    public CommandLineReactor createReactor(CommandLine cl) {
        final NullProgressMonitor pm = new NullProgressMonitor();
        final String projectKey = (String) cl.getValue(ARG_PROJECTKEY);
        final Project project = getJiraRestClient().getProjectClient().getProject(projectKey, pm);
        return new JiraShowProjectReactor(project);
    }
    
}
